#-------------------------------------------------------------------------------
#   Compiler
#-------------------------------------------------------------------------------
cc=g++
cco=$(cc) $(CFLAGS) $(GENERAL_INCLUDES) -o $@
#-------------------------------------------------------------------------------
#   Flags
#-------------------------------------------------------------------------------
DEBUG= -g
CFLAGS = -Wall -c $(DEBUG) -std=c++0x
LFLAGS = -Wall $(DEBUG) -std=c++0x
SDL_CFLAGS=$(shell sdl-config --cflags)
SDL_LDFLAGS=$(shell sdl-config --libs)

#-------------------------------------------------------------------------------
#   Directories
#-------------------------------------------------------------------------------
PROJECT_DIR=$(SRC_DIR)/
EXE=$(EXE_DIR)/
OBJ=$(OBJ_DIR)/

#-------------------------------------------------------------------------------
#   Includes
#-------------------------------------------------------------------------------
USR_INCLUDE=/usr/include
GCC_INCLUDE=/usr/lib/gcc
LOCAL_INCLUDE=/usr/local/include
SDL_LIBRARY=-lSDL
YAML_FLAG=-lyaml
YAML_INCLUDE=$(PWD)/yaml-cpp/include/
YAML_LIBRARY=/usr/include/x86-64-linux-gnu/

GENERAL_INCLUDES=-I$(USR_INCLUDE) -I$(GCC_INCLUDE) -I$(LOCAL_INCLUDE) \
				$(SDL_LIBRARY) -L$(YAML_LIBRARY) -I$(YAML_INCLUDE)

#-------------------------------------------------------------------------------
#   Todo
#-------------------------------------------------------------------------------

all: 	$(EXE)test
	@echo 'test -> Actualizado!'
	
#-------------------------------------------------------------------------------
#YAML_OBJS=$(OBJ)aliasmanager.o\
#	$(OBJ)binary.o \
#	$(OBJ)conversion.o \
#	$(OBJ)directives.o \
#	$(OBJ)emitfromevents.o \
#	$(OBJ)emitter.o \
#	$(OBJ)emitterstate.o\
#	$(OBJ)emitterutils.o\
#	$(OBJ)exp.o\
#	$(OBJ)iterator.o\
#	$(OBJ)nodebuilder.o\
#	$(OBJ)node.o\
#	$(OBJ)nodeownership.o\
#	$(OBJ)null.o\
#	$(OBJ)ostream.o\
#	$(OBJ)parser.o\
#	$(OBJ)regex.o\
#	$(OBJ)scanner.o\
#	$(OBJ)scanscalar.o\
#	$(OBJ)scantag.o\
#	$(OBJ)scantoken.o\
#	$(OBJ)simplekey.o\
#	$(OBJ)singledocparser.o\
#	$(OBJ)stream.o \
#	$(OBJ)tag.o

#YAML_OBJS=$(CXX_SRCS:%.cpp=$(OBJ)%.o)

OBJ_CAP=$(OBJ)manager.o \
		$(OBJ)screen.o \
		$(OBJ)yamlparser.o \
		$(OBJ)main.o

#-------------------------------------------------------------------------------
#   Ejecutable
#-------------------------------------------------------------------------------

$(EXE)test: $(OBJ_CAP) 
	@$S
	$(cc) $(LFLAGS) $(SDL_LDFLAGS) $(YAML_FLAG) $(GENERAL_INCLUDES) $(OBJ_CAP) -o $(EXE)test
	
#-------------------------------------------------------------------------------
#   MANAGER
#-------------------------------------------------------------------------------
$(OBJ)manager.o: $(PROJECT_DIR)Game_Manager.cpp
	@$S
	$(cco) $(SDL_CFLAGS) $(PROJECT_DIR)Game_Manager.cpp

#-------------------------------------------------------------------------------
#	SCREEN
#-------------------------------------------------------------------------------
$(OBJ)screen.o: $(PROJECT_DIR)Screen.cpp
	@$S
	$(cco) $(SDL_CFLAGS) $(PROJECT_DIR)Screen.cpp 

#-------------------------------------------------------------------------------
#	PARSER
#-------------------------------------------------------------------------------
$(OBJ)yamlparser.o: $(PROJECT_DIR)YamlParser.cpp
	@$S
	$(cco) $(YAML_FLAG) $(PROJECT_DIR)YamlParser.cpp 


#-------------------------------------------------------------------------------
#   Objetos Main
#-------------------------------------------------------------------------------

$(OBJ)main.o: $(PROJECT_DIR)main_test.cpp
	@$S
	$(cco) $(PROJECT_DIR)main_test.cpp
	@echo 'Generado: main.o'
	
#-------------------------------------------------------------------------------
clean :
	@$S
	rm -rf $(OBJ_CAP) test 
	@echo 'Cleaned test !'

#-------------------------------------------------------------------------------
